﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Collections;

namespace BBMS.FrontEnd.Constant
{
    public class ConfigFromFile
    {
        public static void AddConnectionString(string name, string cnn)
        {
            ConnectionStringSettingsCollection config = ConfigurationManager.ConnectionStrings;
            config.Add(new ConnectionStringSettings(name, cnn));
        }

        public static void RemoveConnectionStringByName(string name)
        {
            ConnectionStringSettingsCollection config = ConfigurationManager.ConnectionStrings;
            config.Remove(name);
        }

        public static Hashtable GetConnectionList()
        {
            Hashtable table = new Hashtable();

            foreach (ConnectionStringSettings cnn in ConfigurationManager.ConnectionStrings)
                table.Add(cnn.Name, cnn.ConnectionString);

            return table;
        }

//         public static ConnectionStringSettings GetDefaultConnection()
//         {
//             ConnectionStringSettingsCollection config = ConfigurationManager.
//         }

    }
}
